home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / gfx / pbm / extra.lzh / extra / src / ppmtomitsu.c < prev   
C/C++ Source or Header  |  1992-03-19  |  20KB  |  608 lines

  1. /* ppmtomitsu.c - read a portable pixmap and produce output for the
  2. **                Mitsubishi S340-10 Thermo-Sublimation Printer
  3. **                (or the S3410-30 parallel interface)
  4. **
  5. ** Copyright (C) 1992 by S.Petra Zeidler
  6. **
  7. ** This software was written for the Max Planck Institut fuer Radioastronomie,
  8. ** Bonn, Germany, Optical Interferometry group
  9. **
  10. ** Permission to use, copy, modify, and distribute this software and its
  11. ** documentation for any purpose and without fee is hereby granted, provided
  12. ** that the above copyright notice appear in all copies and that both that
  13. ** copyright notice and this permission notice appear in supporting
  14. ** documentation.  This software is provided "as is" without express or
  15. ** implied warranty.
  16. */
  17.  
  18. static char SCCSid[] = "@(#)ppmtomitsu.c\t\t1.5\t(SPZ)\t3/11/92\n";
  19. #include "ppm.h"
  20. #include "ppmcmap.h"
  21. #include "pbmplus.h"
  22. #ifndef AMIGA
  23. #include <memory.h>
  24. #endif /* AMIGA */
  25. #include "mitsu.h"
  26.  
  27. #ifdef __STDC__
  28. void main(int argc, char *argv[] )
  29. #else
  30. void main( argc, argv )
  31.     int argc;
  32.     char* argv[];
  33. #endif
  34.     {
  35.     FILE             *ifp;
  36.     hashinfo         colorhashtable[HASHSIZE];
  37.     struct hashinfo  *hashrun;
  38.     pixel            *xP;
  39.     int              argn;
  40.     int              cols, rows, format, col, row;
  41.     int              sharpness, enlarge, copy, tiny;
  42.     pixval           maxval;
  43.     struct mediasize medias;
  44.     char             media[16];
  45.     char *usage = "[-sharpness <1-4>] [-enlarge <1-3>] [-media <a,a4,as,a4s>] [-copy <1-9>] [-tiny] [ppmfile]";
  46.  
  47.     ppm_init(&argc, argv);
  48.  
  49.     argn = 1;
  50.     sharpness = 32;
  51.     enlarge   = 1;
  52.     copy      = 1;
  53.     memset(media, '\0', 16);
  54.     tiny      = FALSE;
  55.  
  56.     /* check for flags */
  57.     while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') {
  58.     if (pm_keymatch(argv[argn], "-sharpness", 2)) {
  59.         ++argn;
  60.         if (argn == argc || sscanf(argv[argn], "%n", &sharpness) != 1)
  61.             pm_usage(usage);
  62.         else if (sharpness < 1 || sharpness > 4)
  63.             pm_usage(usage);
  64.         }
  65.     else if (pm_keymatch(argv[argn], "-enlarge", 2)) {
  66.         ++argn;
  67.         if (argn == argc || sscanf(argv[argn], "%n", &enlarge) != 1)
  68.             pm_usage(usage);
  69.         else if (enlarge < 1 || enlarge > 3)
  70.             pm_usage(usage);
  71.         }
  72.     else if (pm_keymatch(argv[argn], "-media", 2)) {
  73.         ++argn;
  74.         if (argn == argc || sscanf(argv[argn], "%s", media) < 1)
  75.             pm_usage(usage);
  76.         else if (mytoupper(media[0]) != 'A')
  77.             pm_usage(usage);
  78.     }
  79.     else if (pm_keymatch(argv[argn], "-copy", 2)) {
  80.         ++argn;
  81.         if (argn == argc || sscanf(argv[argn], "%n", ©) != 1)
  82.             pm_usage(usage);
  83.         else if (copy < 1 || copy > 9)
  84.             pm_usage(usage);
  85.         }
  86.     else if (pm_keymatch(argv[argn], "-tiny", 2))
  87.         tiny = TRUE;
  88.     else
  89.         pm_usage(usage);
  90.         ++argn;
  91.     }
  92.  
  93.     if (argn < argc) {
  94.         ifp = pm_openr(argv[argn]);
  95.         ++argn;
  96.     }
  97.     else
  98.         ifp = stdin;
  99.  
  100.     if (argn != argc)
  101.         pm_usage(usage);
  102.  
  103.     if (mytoupper(media[0]) == 'A')
  104.         switch (mytoupper(media[1])) {
  105.         case 'S':
  106.             medias = MSize_AS;
  107.             break;
  108.         case '4':
  109.             if(mytoupper(media[2]) == 'S')
  110.                 medias = MSize_A4S;
  111.             else {
  112.                 medias = MSize_A4;
  113.             }
  114.             break;
  115.         default:
  116.             medias = MSize_A;
  117.         }
  118.     else
  119.         medias = MSize_User;
  120.  
  121.     if (tiny) {
  122.         pixel            *pixelrow;
  123.         char             *redrow, *greenrow, *bluerow;
  124.  
  125.         ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
  126.         pixelrow = (pixel *) ppm_allocrow(cols);
  127.         if ((redrow = malloc(cols * sizeof(char))) == NULL) {
  128.             fprintf(stderr, "ppmtomitsu: malloc failed, exiting\n");
  129.             exit(1);
  130.         }
  131.         if ((greenrow = malloc( cols * sizeof(char))) == NULL) {
  132.             fprintf(stderr, "ppmtomitsu: malloc failed, exiting\n");
  133.             exit(1);
  134.         }
  135.         if ((bluerow = malloc( cols * sizeof(char))) == NULL) {
  136.             fprintf(stderr, "ppmtomitsu: malloc failed, exiting\n");
  137.             exit(1);
  138.         }
  139.         lineputinit(cols, rows, sharpness, enlarge, copy, medias);
  140.  
  141.         for ( row = 0; row < rows; ++row ) {
  142.             ppm_readppmrow(ifp, pixelrow, cols, maxval, format);
  143.             switch(PPM_FORMAT_TYPE(format)) {
  144.             /* color */
  145.             case PPM_TYPE:
  146.                 for (col = 0, xP = pixelrow; col < cols; col++, xP++) {
  147.                     /* First red. */
  148.                     redrow[col] = PPM_GETR(*xP);
  149.                     /* Then green. */
  150.                     greenrow[col] = PPM_GETG(*xP);
  151.                     /* And blue. */
  152.                     bluerow[col] = PPM_GETB(*xP);
  153.                 }
  154.                 data(redrow,   cols);
  155.                 data(greenrow, cols);
  156.                 data(bluerow,  cols);
  157.                 break;
  158.             /* grayscale */
  159.             default:
  160.                 for (col = 0, xP = pixelrow; col < cols; col++, xP++)
  161.                     bluerow[col] = PPM_GETB(*xP);
  162.                 data(bluerow, cols);
  163.                 data(bluerow, cols);
  164.                 data(bluerow, cols);
  165.                 break;
  166.             }
  167.         }
  168.         pm_close(ifp);
  169.     }
  170.     else {
  171.         pixel            **pixelpic;
  172.         int              colanz, colval;
  173.         int                 i;
  174.         colorhist_vector table;
  175.  
  176.         ppm_readppminit( ifp, &cols, &rows, &maxval, &format );
  177.         pixelpic = ppm_allocarray( cols, rows );
  178.         for (row = 0; row < rows; row++)
  179.             ppm_readppmrow( ifp, pixelpic[row], cols, maxval, format );
  180.         pm_close(ifp);
  181.  
  182.         /* first check wether we can use the lut transfer */
  183.  
  184.         table = ppm_computecolorhist(pixelpic, cols, rows, MAXLUTCOL+1, &colanz);
  185.         if (table != NULL) {
  186.             for (i=0; i<HASHSIZE; i++) {
  187.                 colorhashtable[i].flag = -1;
  188.                 colorhashtable[i].next = NULL;
  189.             }
  190.  
  191.             /* we can use the lookuptable */
  192.             pm_message("found %d colors - using the lookuptable-method",colanz);
  193.             lookuptableinit(sharpness, enlarge, copy, medias);
  194.             switch(PPM_FORMAT_TYPE(format)) {
  195.             /* color */
  196.             case PPM_TYPE:
  197.                 for (colval=0; colval<colanz; colval++) {
  198.                     cmd('$');
  199.                     datum(colval);
  200.                     datum(PPM_GETR((table[colval]).color));
  201.                     datum(PPM_GETG((table[colval]).color));
  202.                     datum(PPM_GETB((table[colval]).color));
  203.  
  204.                     hashrun = &colorhashtable[myhash((table[colval]).color)];
  205.                     if (hashrun->flag == -1) {
  206.                         hashrun->color = (table[colval]).color;
  207.                         hashrun->flag  = colval;
  208.                     }
  209.                     else {
  210.                         while (hashrun->next != NULL)
  211.                             hashrun = hashrun->next;
  212.                         if ((hashrun->next =
  213.                                                 (struct hashinfo *) malloc(sizeof(struct hashinfo)))
  214.                                                                 == NULL) {
  215.                             fprintf(stderr, "%s: malloc failed, exiting\n",
  216.                                 argv[0]);
  217.                             exit(2);
  218.                         }
  219.                         hashrun = hashrun->next;
  220.                         hashrun->color = (table[colval]).color;
  221.                         hashrun->flag  = colval;
  222.                         hashrun->next  = NULL;
  223.                     }
  224.                 }
  225.                 break;
  226.             /* other */
  227.             default:
  228.                 for (colval=0; colval<colanz; colval++) {
  229.                     cmd('$');
  230.                     datum(colval);
  231.                     datum(PPM_GETB((table[colval]).color));
  232.                     datum(PPM_GETB((table[colval]).color));
  233.                     datum(PPM_GETB((table[colval]).color));
  234.  
  235.                     hashrun = &colorhashtable[myhash((table[colval]).color)];
  236.                     if (hashrun->flag == -1) {
  237.                         hashrun->color = (table[colval]).color;
  238.                         hashrun->flag  = colval;
  239.                     }
  240.                     else {
  241.                         while (hashrun->next != NULL)
  242.                             hashrun = hashrun->next;
  243.                         if ((hashrun->next =
  244.                                                 (struct hashinfo *) malloc(sizeof(struct hashinfo)))
  245.                                                                 == NULL) {
  246.                             fprintf(stderr, "%s: malloc failed, exiting\n",
  247.                                 argv[0]);
  248.                             exit(2);
  249.                         }
  250.                         hashrun = hashrun->next;
  251.                         hashrun->color = (table[colval]).color;
  252.                         hashrun->flag  = colval;
  253.                         hashrun->next  = NULL;
  254.                     }
  255.                 }
  256.             }
  257.             lookuptabledata(cols, rows, enlarge, medias);
  258.             for (row=0; row<rows; row++) {
  259.                 xP = pixelpic[row];
  260.                 for (col=0; col<cols; col++, xP++) {
  261.                     hashrun = &colorhashtable[myhash(*xP)];
  262.                     while (!PPM_EQUAL((hashrun->color), *xP))
  263.                         if (hashrun->next != NULL)
  264.                             hashrun = hashrun->next;
  265.                         else {
  266.                             fprintf(stderr, "%s: you just found a letal bug.\n",
  267.                                 argv[0]);
  268.                             exit(1);
  269.                         }
  270.                     datum(hashrun->flag);
  271.                 }
  272.             }
  273.         }
  274.         else {
  275.         /* $#%@^!& no lut possible, so send the pic as 24bit */
  276.             pm_message("found too many colors for fast lookuptable mode");
  277.             frametransferinit(cols, rows, sharpness, enlarge, copy, medias);
  278.             switch(PPM_FORMAT_TYPE(format)) {
  279.             /* color */
  280.             case PPM_TYPE:
  281.                 COLORDES(RED);
  282.                 DATASTART;                    /* red coming */
  283.                 for (row=0; row<rows; row++) {
  284.                     xP = pixelpic[row];
  285.                     for (col=0; col<cols; col++, xP++)
  286.                         datum(PPM_GETR(*xP));
  287.                 }
  288.                 COLORDES(GREEN);
  289.                 DATASTART;                    /* green coming */
  290.                 for (row=0; row<rows; row++) {
  291.                     xP = pixelpic[row];
  292.                     for (col=0; col<cols; col++, xP++)
  293.                         datum(PPM_GETG(*xP));
  294.                 }
  295.                 COLORDES(BLUE);
  296.                 DATASTART;                    /* blue coming */
  297.                 for (row=0; row<rows; row++) {
  298.                     xP = pixelpic[row];
  299.                     for (col=0; col<cols; col++, xP++)
  300.                         datum(PPM_GETB(*xP));
  301.                 }
  302.                 break;
  303.             /* grayscale */
  304.             default:
  305.                 COLORDES(RED);
  306.                 DATASTART;                    /* red coming */
  307.                 for (row=0; row<rows; row++) {
  308.                     xP = pixelpic[row];
  309.                     for (col=0; col<cols; col++, xP++)
  310.                         datum(PPM_GETB(*xP));
  311.                 }
  312.                 COLORDES(GREEN);
  313.                 DATASTART;                    /* green coming */
  314.                 for (row=0; row<rows; row++) {
  315.                     xP = pixelpic[row];
  316.                     for (col=0; col<cols; col++, xP++)
  317.                         datum(PPM_GETB(*xP));
  318.                 }
  319.                 COLORDES(BLUE);
  320.                 DATASTART;                    /* blue coming */
  321.                 for (row=0; row<rows; row++) {
  322.                     xP = pixelpic[row];
  323.                     for (col=0; col<cols; col++, xP++)
  324.                         datum(PPM_GETB(*xP));
  325.                 }
  326.             }
  327.         }
  328.     }
  329.     PRINTIT;
  330.     exit(0);
  331. }
  332.  
  333. #ifdef __STDC__
  334. static void lineputinit(int cols, int rows,
  335.                         int sharpness, int enlarge, int copy,
  336.                         struct mediasize medias)
  337. #else /*__STDC__*/
  338. static int lineputinit(cols, rows, sharpness, enlarge, copy, medias)
  339.     int cols, rows;
  340.     int sharpness, enlarge, copy;
  341.     struct mediasize medias;
  342. #endif /*__STDC__*/
  343. {
  344.     ONLINE;
  345.     CLRMEM;
  346.     MEDIASIZE(medias);
  347.  
  348.     switch (enlarge) {
  349.     case 2:
  350.         HENLARGE(ENLARGEx2); /* enlarge horizontal */
  351.         VENLARGE(ENLARGEx2); /* enlarge vertical */
  352.         break;
  353.     case 3:
  354.         HENLARGE(ENLARGEx3); /* enlarge horizontal */
  355.         VENLARGE(ENLARGEx3); /* enlarge vertical */
  356.         break;
  357.     default:
  358.         HENLARGE(NOENLARGE); /* enlarge horizontal */
  359.         VENLARGE(NOENLARGE); /* enlarge vertical */
  360.     }
  361.  
  362.     COLREVERSION(DONTREVERTCOLOR);
  363.     NUMCOPY(copy);
  364.  
  365.     HOFFINCH('\000');
  366.     VOFFINCH('\000');
  367.     CENTERING(DONTCENTER);
  368.  
  369.     TRANSFERFORMAT(LINEORDER);
  370.     COLORSYSTEM(RGB);
  371.     GRAYSCALELVL(BIT_8);
  372.  
  373.     switch (sharpness) {          /* sharpness :-) */
  374.     case 0:
  375.         SHARPNESS(SP_NONE);
  376.         break;
  377.     case 1:
  378.         SHARPNESS(SP_LOW);
  379.         break;
  380.     case 2:
  381.         SHARPNESS(SP_MIDLOW);
  382.         break;
  383.     case 3:
  384.         SHARPNESS(SP_MIDHIGH);
  385.         break;
  386.     case 4:
  387.         SHARPNESS(SP_HIGH);
  388.         break;
  389.     default:
  390.         SHARPNESS(SP_USER);
  391.     }
  392.     if (cols > rows) {
  393.         ROTATEIMG(DOROTATE);                        /* rotate image */
  394.         if (enlarge*rows > medias.maxcols || enlarge*cols > medias.maxrows) {
  395.             fprintf(stderr, "ppmtomitsu: Image too large, MaxPixels = %d x %d\n"
  396.                           , medias.maxrows, medias.maxcols);
  397.             exit(1);
  398.         }
  399.         HPIXELS(cols);
  400.         VPIXELS(rows);
  401.         HPIXELSOFF((medias.maxcols - enlarge*rows)/2);
  402.         VPIXELSOFF((medias.maxrows - enlarge*cols)/2);
  403.         pm_message("rotating image for output");
  404.     }
  405.     else {
  406.         ROTATEIMG(DONTROTATE);
  407.         if (enlarge*rows > medias.maxrows || enlarge*cols > medias.maxcols) {
  408.             fprintf(stderr, "ppmtomitsu: Image too large, MaxPixels = %d x %d\n"
  409.                           , medias.maxrows, medias.maxcols);
  410.             exit(1);
  411.         }
  412.         HPIXELS(cols);
  413.         VPIXELS(rows);
  414.         HPIXELSOFF((medias.maxcols - enlarge*cols)/2);
  415.         VPIXELSOFF((medias.maxrows - enlarge*rows)/2);
  416.     }
  417.     DATASTART;
  418.     return;
  419. }
  420.  
  421. #ifdef __STDC__
  422. static void lookuptableinit(int sharpness, int enlarge, int copy,
  423.                             struct mediasize medias)
  424. #else /*__STDC__*/
  425. static int lookuptableinit(sharpness, enlarge, copy, medias)
  426.     int sharpness, enlarge, copy;
  427.     struct mediasize medias;
  428. #endif /*__STDC__*/
  429. {
  430.     ONLINE;
  431.     CLRMEM;
  432.     MEDIASIZE(medias);
  433.  
  434.     switch (enlarge) {
  435.     case 2:
  436.         HENLARGE(ENLARGEx2); /* enlarge horizontal */
  437.         VENLARGE(ENLARGEx2); /* enlarge vertical */
  438.         break;
  439.     case 3:
  440.         HENLARGE(ENLARGEx3); /* enlarge horizontal */
  441.         VENLARGE(ENLARGEx3); /* enlarge vertical */
  442.         break;
  443.     default:
  444.         HENLARGE(NOENLARGE); /* enlarge horizontal */
  445.         VENLARGE(NOENLARGE); /* enlarge vertical */
  446.     }
  447.  
  448.     COLREVERSION(DONTREVERTCOLOR);
  449.     NUMCOPY(copy);
  450.  
  451.     HOFFINCH('\000');
  452.     VOFFINCH('\000');
  453.     CENTERING(DONTCENTER);
  454.  
  455.     TRANSFERFORMAT(LOOKUPTABLE);
  456.  
  457.     switch (sharpness) {          /* sharpness :-) */
  458.     case 0:
  459.         SHARPNESS(SP_NONE);
  460.         break;
  461.     case 1:
  462.         SHARPNESS(SP_LOW);
  463.         break;
  464.     case 2:
  465.         SHARPNESS(SP_MIDLOW);
  466.         break;
  467.     case 3:
  468.         SHARPNESS(SP_MIDHIGH);
  469.         break;
  470.     case 4:
  471.         SHARPNESS(SP_HIGH);
  472.         break;
  473.     default:
  474.         SHARPNESS(SP_USER);
  475.     }
  476.  
  477.     LOADLOOKUPTABLE;
  478.     return;
  479. }
  480.  
  481. #ifdef __STDC__
  482. static void lookuptabledata(int cols, int rows, int enlarge,
  483.                                                         struct mediasize medias)
  484. #else /*__STDC__*/
  485. static int lookuptabledata(cols, rows, enlarge, medias)
  486.     int   rows, cols;
  487.     int   enlarge;
  488.     struct mediasize medias;
  489. #endif /*__STDC__*/
  490. {
  491.     DONELOOKUPTABLE;
  492.     if (cols > rows) {
  493.         ROTATEIMG(DOROTATE);                        /* rotate image */
  494.         if (enlarge*rows > medias.maxcols || enlarge*cols > medias.maxrows) {
  495.             fprintf(stderr, "ppmtomitsu: Image too large, MaxPixels = %d x %d\n"
  496.                           , medias.maxrows, medias.maxcols);
  497.             exit(1);
  498.         }
  499.         HPIXELS(cols);
  500.         VPIXELS(rows);
  501.         HPIXELSOFF((medias.maxcols - enlarge*rows)/2);
  502.         VPIXELSOFF((medias.maxrows - enlarge*cols)/2);
  503.         pm_message("rotating image for output");
  504.     }
  505.     else {
  506.         ROTATEIMG(DONTROTATE);
  507.         if (enlarge*rows > medias.maxrows || enlarge*cols > medias.maxcols) {
  508.             fprintf(stderr, "ppmtomitsu: Image too large, MaxPixels = %d x %d\n"
  509.                           , medias.maxrows, medias.maxcols);
  510.             exit(1);
  511.         }
  512.         HPIXELS(cols);
  513.         VPIXELS(rows);
  514.         HPIXELSOFF((medias.maxcols - enlarge*cols)/2);
  515.         VPIXELSOFF((medias.maxrows - enlarge*rows)/2);
  516.     }
  517.     DATASTART;
  518.     return;
  519. }
  520.  
  521. #ifdef __STDC__
  522. static void frametransferinit(int cols, int rows, int sharpness,
  523.                               int enlarge, int copy, struct mediasize medias)
  524. #else
  525. static int frametransferinit(cols, rows, sharpness, enlarge, copy, medias)
  526.  
  527.     int     rows, cols;
  528.     int     sharpness, enlarge, copy;
  529.     struct mediasize medias;
  530. #endif
  531. {
  532.     ONLINE;
  533.     CLRMEM;
  534.     MEDIASIZE(medias);
  535.  
  536.     switch (enlarge) {
  537.     case 2:
  538.         HENLARGE(ENLARGEx2); /* enlarge horizontal */
  539.         VENLARGE(ENLARGEx2); /* enlarge vertical */
  540.         break;
  541.     case 3:
  542.         HENLARGE(ENLARGEx3); /* enlarge horizontal */
  543.         VENLARGE(ENLARGEx3); /* enlarge vertical */
  544.         break;
  545.     default:
  546.         HENLARGE(NOENLARGE); /* enlarge horizontal */
  547.         VENLARGE(NOENLARGE); /* enlarge vertical */
  548.     }
  549.  
  550.     COLREVERSION(DONTREVERTCOLOR);
  551.     NUMCOPY(copy);
  552.  
  553.     HOFFINCH('\000');
  554.     VOFFINCH('\000');
  555.     CENTERING(DONTCENTER);
  556.  
  557.     TRANSFERFORMAT(FRAMEORDER);
  558.     COLORSYSTEM(RGB);
  559.     GRAYSCALELVL(BIT_8);
  560.  
  561.     switch (sharpness) {          /* sharpness :-) */
  562.     case 0:
  563.         SHARPNESS(SP_NONE);
  564.         break;
  565.     case 1:
  566.         SHARPNESS(SP_LOW);
  567.         break;
  568.     case 2:
  569.         SHARPNESS(SP_MIDLOW);
  570.         break;
  571.     case 3:
  572.         SHARPNESS(SP_MIDHIGH);
  573.         break;
  574.     case 4:
  575.         SHARPNESS(SP_HIGH);
  576.         break;
  577.     default:
  578.         SHARPNESS(SP_USER);
  579.     }
  580.     if (cols > rows) {
  581.         ROTATEIMG(DOROTATE);                        /* rotate image */
  582.         if (enlarge*rows > medias.maxcols || enlarge*cols > medias.maxrows) {
  583.             fprintf(stderr, "ppmtomitsu: Image too large, MaxPixels = %d x %d\n"
  584.                           , medias.maxrows, medias.maxcols);
  585.             exit(1);
  586.         }
  587.         HPIXELS(cols);
  588.         VPIXELS(rows);
  589.         HPIXELSOFF((medias.maxcols - enlarge*rows)/2);
  590.         VPIXELSOFF((medias.maxrows - enlarge*cols)/2);
  591.         pm_message("rotating image for output");
  592.     }
  593.     else {
  594.         ROTATEIMG(DONTROTATE);
  595.         if (enlarge*rows > medias.maxrows || enlarge*cols > medias.maxcols) {
  596.             fprintf(stderr, "ppmtomitsu: Image too large, MaxPixels = %d x %d\n"
  597.                           , medias.maxrows, medias.maxcols);
  598.             exit(1);
  599.         }
  600.         HPIXELS(cols);
  601.         VPIXELS(rows);
  602.         HPIXELSOFF((medias.maxcols - enlarge*cols)/2);
  603.         VPIXELSOFF((medias.maxrows - enlarge*rows)/2);
  604.     }
  605.     return;
  606. }
  607.  
  608.